/**
 * Created by IntelliJ IDEA.
 * User: mstine
 * Date: Mar 20, 2008
 * Time: 3:03:14 PM
 * To change this template use File | Settings | File Templates.
 */
class Duck {
    void walk() {
        println("walking!")
    }

    void quack() {
        println("QUACK!")
    }
}

class MentalPatient {
    void walk() {
        println("walking!")
    }

    void quack() {
        println("QUACK!")
    }
}

[new Duck(), new MentalPatient()].each {
    if (it.metaClass.respondsTo(it,"walk") && it.metaClass.respondsTo(it,"quack")) {
        println("it is a duck!")
    }
}

//GOTO: moreMoreMetaprogramming.groovy


